﻿using System;
using System.Globalization;
using System.Windows.Data;
using MathematicallySafe.HeadCounter.Data.Common;
using MathematicallySafe.HeadCounter.Data.Models;

namespace MathematicallySafe.HeadCounter.Converters
{
    [ValueConversion(typeof (CharacterClass), typeof (string))]
    public class ClassColourConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Warcraft.ClassColourString((CharacterClass) value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }

        #endregion
    }

    [ValueConversion(typeof (CharacterClass), typeof (string))]
    public class SocketColourConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var socket = (SocketType) value;
            if (socket == SocketType.Blue) return "Blue";
            if (socket == SocketType.Red) return "Red";
            if (socket == SocketType.Yellow) return "Yellow";
            if (socket == SocketType.Meta) return "Silver";

            return "Gray";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return null;
        }

        #endregion
    }
}